cmake_minimum_required(VERSION 2.6)

PROJECT(FingerGuessing)

MESSAGE(STATUS "PROJECT : FingerGuessing PROJERT")

macro(USE_CXX11) # use c++11
    if (CMAKE_VERSION VERSION_LESS "3.1")
        if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
            set (CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
	    endif ()
    else ()
        set (CMAKE_CXX_STANDARD 11)
    endif ()
endmacro(USE_CXX11)
use_cxx11()
  

set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g -ggdb") 
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -W3 -g -ggdb") 

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")

link_directories( # link lib directorys
    ${PROJECT_SOURCE_DIR}/libs/linux
)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
    message(STATUS "Using libs/linux/debug")
    link_directories(
        ${PROJECT_SOURCE_DIR}/libs/linux/debug
	)
else()
    message(STATUS "Using libs/linux/release")
    link_directories(
        ${PROJECT_SOURCE_DIR}/libs/linux/release
	)
endif()

ADD_SUBDIRECTORY(base)
ADD_SUBDIRECTORY(server)
ADD_SUBDIRECTORY(client)

EXEC_PROGRAM(mkdir ARGS "${PROJECT_BINARY_DIR}/libs" OUTPUT_VARIABLE OUTPUT RETURN_VALUE RVALUE)
EXEC_PROGRAM(cp ARGS "${PROJECT_SOURCE_DIR}/libs/* ${PROJECT_BINARY_DIR}/libs" OUTPUT_VARIABLE OUTPUT RETURN_VALUE RVALUE)
